<?php

namespace App\Http\Controllers\User;


use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;

class CompanyController extends Controller
{
    public function getHonor(){
        try{
            $chose =DB::table('aboutcompany')->where('type','=','4')->select('aboutcompany_id','aboutcompany_content','time')->get();
            return json_encode(['msg'=>1,'data' => $chose]);

        }catch (Exception $e){

            $info =  $e->getMessage().'failed line:'.$e->getLine().'failed string:'.$e->getTraceAsString();
            return json_encode(['msg'=>0,'data' => $info]);
            exit;
        }
    }

    public function getTrajectory()
    {
        try{
            $chose =DB::table('aboutcompany')->where('type','=','5')->select('aboutcompany_id','aboutcompany_content','time')->get();
            return json_encode(['msg'=>1,'data' => $chose]);

        }catch (Exception $e){

            $info =  $e->getMessage().'failed line:'.$e->getLine().'failed string:'.$e->getTraceAsString();
            return json_encode(['msg'=>0,'data' => $info]);
            exit;
        }
    }

    public function getCompanyInfo(){

        try{
            $chose =DB::table('aboutcompany')->where('type','=','3')->select('aboutcompany_id','aboutcompany_content','time','aboutcompany_image')->get();
            return json_encode(['msg'=>1,'data' => $chose]);

        }catch (Exception $e){

            $info =  $e->getMessage().'failed line:'.$e->getLine().'failed string:'.$e->getTraceAsString();
            return json_encode(['msg'=>0,'data' => $info]);
            exit;
        }
    }

    public function getExhibition(){

        try{
            $chose =DB::table('aboutcompany')->where('type','=','6')->select('other','title','aboutcompany_image')->get();
            return json_encode(['msg'=>1,'data' => $chose]);

        }catch (Exception $e){

            $info =  $e->getMessage().'failed line:'.$e->getLine().'failed string:'.$e->getTraceAsString();
            return json_encode(['msg'=>0,'data' => $info]);
            exit;
        }
    }

}
